package back_end;

import java.util.HashMap;
class Router {
    protected HashMap<String, Operator> hm = new HashMap<>();
    Router() {
        hm.put("borrow", new Borrow());
        hm.put("search", new search());
        hm.put("showBorrowed", new showBorrowed());
        hm.put("return", new reeturn());
        hm.put("recommend", new recommend());
        hm.put("check", new check());
        hm.put("showRecoms", new showRecoms());
        hm.put("dealRecoms", new dealRecoms());
        hm.put("showStudents", new showStudents());
        hm.put("freezing", new freezing());
    }
    
    protected String show(int k) {
        StringBuilder sb = new StringBuilder();
       var d =  hm.values().stream();
        
        var ccc = hm.values().stream().filter(o -> o.getLevel() <= k);
        ccc.forEach((ooo) -> {
            if (ooo.name.equals("borrow") || ooo.name.equals("check")) {
            } else {
                sb.append(ooo.name).append(" ");
            }
        });
        return sb.toString();
    }
}
